import request from '@/utils/http'

export function getAssignmentById (id) {
    return request({
        url: `assignment/${id}`,
        method: 'get'
    })
}

export function listAssignments (page, pageSize) {
    return request({
        url: 'assignment',
        method: 'get',
        params: { page, pageSize }
    })
}

export function createAssignments (data) {
    return request({
        url: 'assignment',
        method: 'post',
        data
    })
}

export function updateAssignment (data) {
    return request({
        url: 'assignment',
        method: 'put',
        data
    })
}

export function deleteAssignmentById (id) {
    return request({
        url: `assignment/${id}`,
        method: 'delete',
    })
}

export function countAssignmentInWeek() {
    return request({
        url: `assignment/count/week`,
        method: 'get',
    })
}

export function getAssignmentsByUser(user) {
    return request({
        url: `assignment/user`,
        method: 'get',
        params: { user }
    })
}